package com.sxz.sbs.module.mine.presenter;

import com.sxz.sbs.app.App;
import com.sxz.sbs.module.mine.mode.UserInfo;
import com.sxz.sbs.module.mine.view.ChangePasswordView;
import com.sxz.sbs.rx.RxPresenter;
import com.sxz.sbs.rx.RxSubscriber;
import com.sxz.sbs.rx.RxUtil;

import java.util.HashMap;

/**
 * 修改密码 P 层
 */

public class ChangePasswordPresenter extends RxPresenter<ChangePasswordView>{
    /**
     * 修改密码
     */
    public void alterPsw (HashMap<String,Object> map) {
        addSubscribe(App.getInstance().getApi().alterPassword(map)
                .compose(RxUtil.<String>handleResult())
                .subscribeWith(new RxSubscriber<String>(mView){
                    @Override
                    public void onNext(String info) {
                        mView.onAlterPasswordSuccess();
                    }
                })
        );
    }
}
